home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Utilities / DVIM72-Mac 1.9.6 / source / TrapAvailable.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-14  |  580 b   |  24 lines  |  [TEXT/R*ch]

  1. #define _InitGraf        0xA86E
  2. #define _Unimplemented    0xA89F
  3.  
  4. Boolean TrapAvailable( short trapnum );
  5.  
  6. #define GetNumToolBoxTraps (NGetTrapAddress(_InitGraf,ToolTrap) == \
  7.     NGetTrapAddress(0xAA6E,ToolTrap)? 0x200 : 0x400)
  8.  
  9. #define TRAP_TYPE(n)    (n & 0x800 ? ToolTrap : OSTrap)
  10.  
  11. Boolean TrapAvailable( short trapnum )
  12. {
  13.     register short    ttype;
  14.     
  15.     ttype = TRAP_TYPE( trapnum );
  16.     if (ttype == ToolTrap)
  17.     {
  18.         trapnum &= 0x7FF;
  19.         if (trapnum >= GetNumToolBoxTraps)
  20.             trapnum = _Unimplemented;
  21.     }
  22.     return (NGetTrapAddress( trapnum, ttype ) !=
  23.         NGetTrapAddress( _Unimplemented, ToolTrap ));
  24. }